package com.predict.javademo.entity.attackAlgParams;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class BasicParam {

    private String attackAlgorithm;

    private String attackModel;

    private String defenseAlgorithm;

    private String originImg;

    private String device;

    private Map<String, String> attach = new HashMap<>();

    //覆盖@Data的set方法，使封装时自动去除前缀
    public void setOriginImg(String originImg) {
        if (originImg.startsWith("data:image")){
            this.originImg = originImg.substring(originImg.indexOf(",") + 1);
        }
    }
}
